home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10324 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news.uregina.ca!usenet
  2. From: tristan@nether.net (Tristan Psionic)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Boot disk
  5. Date: 16 Mar 1996 21:04:55 GMT
  6. Organization: University of Regina
  7. Message-ID: <4ifadn$j3s@sue.cc.uregina.ca>
  8. References: <3144FCDF.38F3@plink.cityu.edu.hk> <Do3xqn.1HB@iquest.net>
  9. Reply-To: tristan@nether.net (Tristan Psionic)
  10. NNTP-Posting-Host: dec5057.cs.uregina.ca
  11. X-Newsreader: IBM NewsReader/2 v1.2.5
  12.  
  13. In <Do3xqn.1HB@iquest.net>, dlmiller@iquest.net (Doug Miller) writes:
  14. >Jonathan Chiu Chi Hang <95471004@plink.cityu.edu.hk> wrote:
  15. >+Dear all,
  16. >+
  17. >+    Does anyone know how to write a program in C to make a disk that
  18. >+redirect the boot drive from drive A to drive B when boot time.  What is
  19. >+the algoithm?  Or provide the source code for reference.
  20. >+
  21. >+    Greatly appreciate any responses.
  22. >+
  23. >+Jonathan
  24. >What you are attempting to do is intrinsically impossible.
  25. >
  26. >Think about it:  what will happen to your program when you reboot the computer?
  27. >
  28. >Further, I'm not aware of *any* PC BIOS that supports booting from the B drive.  Switching your A and B drives
  29. >*cannot* be done solely through software, as you must either (1) swap cable connections on the drives, or (2) change
  30. >jumper settings on both drives; if the drives have different capacities (e.g. 1.2 MB and 1.44 MB), you must also alter
  31. >the BIOS settings for the drives (which can be done through software).
  32.  
  33. Well, relax a little bit.  You could do something to redirect it, but probably not
  34. in C. The answer is as simple as remembering what a master boot record on a 
  35. hard drive does: loads in the real boot sector.  So the MBR has pointers to hard
  36. drive partitions and one of them holds the sector that will load the OS.  The
  37. MBR does nothing but handle loading another boot sector *from somewhere else*.
  38. The only way to do it, however, is to write a boot-sector to put on a disk in
  39. drive A: that reads in the boot sector from drive B: and jumps there.  It may
  40. still be more complicated then that, as a boot sector probably uses some 
  41. standardized drive code (0 for drive A: and 80h for drive C:) that is hard-coded
  42. into the boot sector code.  So, you may have to peel through and switch stuff
  43. to point at B: (1 in BIOS terms).  Think assembly though, C probably won't cut
  44. it.  Write me, I can help you code it.
  45. -tristan (tristan@nether.net)
  46.